package cn.zebra.dev.order.module.item.service.impl;

import cn.zebra.dev.ibatis.plus.service.impl.ServiceImpl;
import cn.zebra.dev.order.module.item.dao.OrdersItemDao;
import cn.zebra.dev.order.module.item.entity.OrdersItemEntity;
import cn.zebra.dev.order.module.item.service.OrdersItemService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author runnable@sina.cn
 */
@Service
public class OrdersItemServiceImpl extends ServiceImpl<OrdersItemDao, OrdersItemEntity> implements OrdersItemService {
    @Override
    public Collection<OrdersItemEntity> findByOrderId(Long orderId) {
        return selectList("orders_id = {0}", orderId);
    }

    @Override
    public List<OrdersItemEntity> findByOrderIds(List<Long> orderIds) {
        QueryWrapper<OrdersItemEntity> wrapper = new QueryWrapper<>();
        wrapper.in("orders_id", orderIds);
        return list(wrapper);
    }

    @Override
    public List<OrdersItemEntity> findByIds(List<Long> ordersItemIds) {
        QueryWrapper<OrdersItemEntity> wrapper = new QueryWrapper<>();
        wrapper.in("id", ordersItemIds);
        return list(wrapper);
    }
}
